<%--
  Created by IntelliJ IDEA.
  User: ThinkPad
  Date: 2020/10/30
  Time: 11:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
</head>
<body>

<script type="text/javascript">
    var user={
        "name":"张三",
        "age":22
    };
    $.ajax({
        url:"jsonType",
        data:JSON.stringify(user),
        type:"post",
        contentType:"application/json;charse=UTF-8",
        dataType:"text",
        success:function (data) {
            var obj =eval("("+data+")");
            alert(obj.name+"---"+obj.age);
        }
    })

</script>

</body>
</html>
